<?php

namespace app\admin\controller;
use think\Db;
use think\Request;
use think\Controller;

class Con3 extends AdminController
{
    public function nodeList()
    {
        $list = Db::table('node')->field(true)->order('id', 'ASC')->select();

        return view('con3/nodelist',[
           'list' => $list
        ]);
    }

    public function add()
    {
        return view('con3/add');
    }



    public function doadd(Request $request)
    {
        $p = $request->post();

        $data = [
            'name' => $p['name'],
            'con_name' => $p['con_name'],
            'way' => $p['way'],
            'status' => $p['status']
        ];

        $result = Db::table('node')->data($data)->insert();

        if ($result > 0) {
            return $this->success('添加成功', url('admin/con3/nodelist'));
        } else {
            return $this->error('添加失败');
        }
    }  

}